4 October 2000

CryoPatch v1.1.0

MaxScript extension Plug-In - User guide (revision 1.0.0)

 

© Copyright 99-00 – Cryo interactive entertainment

Author : Thierry Pellegrini - Graphical Supervision Department

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1.    Introduction to patches in 3DSMax 3..................................................................... 2

1.1. Quad-Patch representation......................................................................................................................................... 2

1.2. Tri-Patch representation.............................................................................................................................................. 3

1.3. Interpolation........................................................................................................................................................................ 3

1.4. Interior points....................................................................................................................................................................... 3

2.    Setup - Plug-in usage.......................................................................................................... 4

2.1. General informations...................................................................................................................................................... 4

2.2. User-visible functions list............................................................................................................................................. 4

2.3. Usage............................................................................................................................................................................................ 5

3.    Functions descriptions................................................................................................... 5

 

 

 

 


 

1.   Introduction to patches in 3DSMax 3

 

This document is a reference guide for the 3DSMax3 Script extension plug-in. It allows the manipulation of editable-patch objects by MaxScript at object, sub-patch, edge and vertex level.

 

Most of the patch object properties can be accessed for reading or writing.

 

 

1.1. Quad-Patch representation

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


Representation of a quad-patch with 3DSMax3

 

 

Vertices, vectors and interior points of a patch are stored into a mesh-like object. There are two ways to access them :

 

·  Directly : with their indexes relative to the mesh


Remark:
Unlike vertices, which are stored in their own, vectors and interior points are stored together in the same array. That’s why the plug-in doesn’t give functions to reach interior points using the mesh. In this case you must work with them like with vectors.

 

·  Indirectly : with their indexes relative to the sub-patch they belong to.

·  Vertices indexes in a sub-patch :  1-A, 2-B, 3-C, 4-D

·  Edges (non oriented) indexes in a sub-patch : 1-AB, 2- BC, 3- CD, 4- DA

·  Vectors (oriented) indexes : 1-AB, 2-BA, 3-BC, 4-CB, 5-CD, 6-DC, 7-DA, 8-AD

·  Interior points indexes in a sub-patch : 1-I1, 2-I2, 3-I3, 4-I4

 

 

1.2. Tri-Patch representation

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


Representation of a tri-patch with 3DSMax3

 

As with the quad-patch, you can access the vertices, vectors and interior points directly with the mesh-indexes, or indirectly, relatively to a sub-patch. The elements’ order is as follows:

 

·         Vertices:  1-A, 2-B, 3-C

·         Edges (non oriented): 1-AB, 2- BC, 3- CA

·         Vectors (oriented): 1-AB, 2-BA, 3-BC, 4-CB, 5-CA, 6-AC

·         Interior points: 1-I1, 2-I2, 3-I3

 

1.3. Interpolation

Two interpolation functions allow you to get the position (local coordinates) and normal vector of any (u,v) point on a patch. Please refer to figures above for the location of a vertex from its (u,v) coordinates.

 

1.4. Interior points

3DSMax provides two modes to set the interior points :

 

·         Manual : like vertices, the user places the interior points.

·         Auto : 3DSMax computes them.
Example : I1 = A + (AB+AD) for a quad-patch.


 

2.   Setup - Plug-in usage

2.1. General informations

Shut down 3DSMax, place the CryoPatch.dlx file in your <$3DSMax3>\Plugins folder, and restart Max.

 

A CryoPatch Function call should look like this : CPatch_<function>

You can get the full list of available functions with the command CPatch_List, and their syntax with the command CPatch_Help.

 

Remarks :

·         Every function that modify the patch participates in the Max Undo/Redo system.

·         BUT, the MaxScript undo context don’t let you group more than 2 undoable operations (?!).

·         When a function modifies the patch, it needs the modifiers stack to be collapsed.

·         3DSMax don’t update the number of mapping vertices after a modification done from the Max interface. Then you must do an explicit call of ShrinkMapVerts to free unused mapping vertices.

 

 

2.2. User-visible functions list

Object

Sub-Patch

Edge

Vector

Vertex

Others

AppendVerts

CreateAdjTriPatch

CreateAdjQuadPatch

CreateMapChannel

CreateTriPatch

CreateQuadPatch

DeleteMapChannel

DeleteSelPatch

GetMapChannels

GetMapPatch

GetMapVert

GetMeshVec

GetMeshVert

GetNumEdges

GetNumMapVerts

GetNumPatches

GetNumVecs

GetNumVerts

GetRenderSteps

GetSel

GetViewSteps

PatchToWorld

SetAllInteriorAuto

SetMapVert

SetMapPatch

SetMeshVec

SetMeshVert

SetRenderSteps

SetSel

SetSelInteriorAuto

SetViewSteps

ShrinkVerts

ShrinkMapVerts

WorldToPatch

DeletePatch

GetAdjacentIndex

GetAdjacentIndexes

GetEdgeIndex

GetEdgeIndexes

GetInteriorAuto

GetInteriorIndex

GetInteriorIndexes

GetMatID

GetPatchInterior

GetPatchVec

GetPatchVert

GetSmGroup

GetSmGroupBits

GetType

GetVecIndex

GetVecIndexes

GetVertIndex

GetVertIndexes

Interpolate

InterpolateNorm

SetInteriorAuto

SetMatID

SetPatchInterior

SetPatchVec

SetPatchVert

SetSmGroup

SetSmGroupBit

 

FuseEdges

GetPatchFromEdge

GetVecFromEdge

GetVertFromEdge

SplitEdge

 

GetEdgeFromVec

GetPatchFromVec

GetVecType

GetVertFromVec

 

GetVertexType

SetVertexType

GetEdgeFromVert

GetPatchFromVert

GetVecFromVert

 

About

Help

List

 


 

2.3. Usage

 

Suggestion :

Numerous functions alter the appearance of a patch, in its geometry, its mapping, etc… If you have several calls to such functions, you should disable the automatic refresh of viewports before calling the CryoPatch functions to speed up the script. You can do that with :

 

DisableSceneRedraw()

  patch modifications

EnableSceneRedraw()

NodeInvalRect <patch_node>

RedrawViews()

 

 

3.   Functions descriptions

Remark about the syntax :

 

Arguments are specified between ‘<’ and ‘>’. A '#' denotes that you’re dealing with an array. The number just after the '#' is the size of the array (n if free). The following expression gives the type of the elements. The character '|' means ‘OR’.

 

Ex : CPatch_CreateAdjQuadPatch <patch> <#4(Integer|Point3)> <#4(Boolean)> 

<patch> is a node

<#4(integer|point3)> is a 4 elements array, each element being an Integer or a Point3

<#4(Boolean)> is an array of 4 Booleans

 

 

About  ()

Description : What, when, who.

 

Arguments : none.

 

Returns : <String> : some essential informations.

 

 

AppendVerts  <Patch>  <#n(Point3)>

Description :  Adds n control points to the patch.

 

Arguments :

·         <Patch> : the target patch node.

·         <#n(Point3)> : an array of n Point3 representing the local coordinates of the n new vertices.

 

Note :  Be careful, these vertices are temporary until used by a sub-patch, and therefore must be handled with care : they’ll be destroyed by a function that shake too much the internal structure like a sub-patch deletion. Don’t let them unused for a long time! This function was made to have sorted arrays of control points in the structure of a patch, for export purpose.

 

See also : ShrinkVerts.

 

 

 

CreateAdjQuadPatch  <Patch>  <#4(Integer|Point3)>  <#4(Boolean)>

Description : Creates a new 4-sided sub-patch, based on 4 existing or new control points. This sub-patch can be made adjacent to any of its 4 neighbors at creation time.

 

Arguments :

·         <Patch> : the target patch node.

·         <#4(Integer|Point3)> : an array of 4 Integer or Point3 elements. Each element is the valid index of an existing vertex (integer), or the position for a new vertex (point3) in local coordinates.

·         <#4(Boolean)> : an array of 4 Booleans, each of them specifying if the matching edge is allowed to be shared with another sub-patch. In other words, it’s an array which lets you indicate the adjacencies to be created for each edge (the order of these edges is AB, BC, CD, DA) (cf. "1. Patches representation with 3DSMax3").

 

Remarks :

·         Adjacency values are an indication, not an obligation. If the adjacency can’t be made, the edge will simply not be shared. This won’t generate any runtime error.

·         For each edge, if more than one sub-patch is a candidate for adjacency, the function chooses the first one.

 

Returns : undefined  if failure, <Integer>: the index of the new sub-patch otherwise.

 

See also : CreateAdjTriPatch, CreateQuadPatch, CreateTriPatch, DeletePatch, DeleteSelPatch.

 

 

CreateAdjTriPatch  <Patch>  <#3(Integer|Point3)>  <#3(Boolean)>

Description : (cf. "CreateAdjQuadPatch")

 

Arguments :

·         <Patch> : the target patch node.

·         <#3(Integer|Point3)> : an array of 3 <Integer or Point3> elements. Each element is the index of an existing vertex (integer), or the position for a new vertex (point3) in local coordinates.

·         <#3(Boolean)> : an array of 3 Booleans, each of them specifies if the matching edge is allowed to be shared with another sub-patch.

 

Returns : undefined  if failure, <Integer> the index of the new patch otherwise.

 

See also : CreateAdjQuadPatch, CreateTriPatch, CreateQuadPatch, DeletePatch, DeleteSelPatch.

 

 

CreateMapChannel  <Patch>  <Integer>

Description : Creates a new mapping channel. It is initialized on the vertices and sub-patches values of the mesh.

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the new mapping channel to create, between 0 and 99.

 

Remarks :

·         3DSMax3 accepts up to 100 mapping channels. The first channel (index 0) is used for RGB colors. Indexes for standard mapping channels go from 1 to 99.

·         Each channel uses at creation time the same number of ‘mapping’ sub-patches as ‘mesh’ sub-patches in the patch-mesh. But these 2 values may be changed independantly at run time.

 

See also: GetMapChannels, DeleteMapChannel.

 

CreateQuadPatch  <Patch>  <#4(Integer|Point3)> 

Description : Creates a (sub) quad-patch based on 4 existing/new vertices. Doesn’t handle adjacencies.

 

Arguments:

·         <Patch>: the target patch node.

·         <#4(Integer|Point3)>: an array of 4 <Integer or Point3> elements. Each element is the valid index of an existing vertex (integer), or the position for a new vertex (point3) in local coordinates.

 

Returns : undefined if failure, <Integer> the index of the new patch otherwise.

 

See also : CreateTriPatch, CreateAdjQuadPatch, CreateAdjTriPatch, DeletePatch, DeleteSelPatch.

 

 

CreateTriPatch  <Patch>  <#3(Integer|Point3)>

Description : Creates a (sub) tri-patch based on 3 existing/new vertices. Doesn’t handle adjacencies.

 

Arguments :

·         <Patch> : the target patch node.

·         <#3(Integer|Point3)>: an array of 3 <Integer or Point3> elements. Each element is the index of an existing vertex (integer), or the position for a new vertex (point3) in local coordinates.

 

Returns: undefined  if failure, <Integer> the index of the new patch otherwise.

 

See also : CreateQuadPatch, CreateAdjTriPatch, CreateAdjQuadPatch, DeletePatch, DeleteSelPatch.

 

 

DeleteMapChannel  <Patch>  <Integer>

Description : This function removes a mapping channel. The currently used mapping channels are listed by GetMapChannels().

 

Arguments:

·         <Patch>: the target patch node.

·         <Integer>: the index of the mapping channel to remove, between 0 and 99.

 

See also: GetMapChannels, CreateMapChannel.

 

 

DeletePatch  <Patch>  <Integer>

Description : Removes a sub-patch.

 

Arguments:

·         <Patch>: the target patch node.

·         <Integer>: the index of the sub-patch to remove.

 

Remark :

The sub-patch removal implies the update of the patch internal structure, so 3DSMax will clean the unused free vertices added with the AppendVerts function.

 

See also : DeleteSelPatch, CreateQuadPatch, CreateTriPatch, CreateAdjQuadPatch, CreateAdjTriPatch.

 

 

 

DeleteSelPatch  <Patch>

Description : Removes the selected sub-patches.

 

Argument: <Patch>: the target patch node.

 

See also : GetSel, DeletePatch, CreateAdjQuadPatch, CreateAdjTriPatch, CreateQuadPatch, CreateTriPatch.

 

 

FuseEdges  <Patch>  <Integer>  <Integer>  <0|1|2|3>

Description : Lets you fuse two unshared edges (i.e. they don’t link two sub-patches) that have the same vertices.

 

Arguments:

<Patch>: the target patch node.

<Integer>: the index of the first edge.

<Integer> : the index of the second edge.

<0|1|2|3> : the method to compute the vectors of the resulting edge :

0 : straight on the segment between the two vertices (length ratio : 1/3).

1 : use the vectors from the first edge

2 : use the vectors from the second edge

3 : averages the vectors of the first edge and the second edge

 

See also: SplitEdge.

 

 

GetAdjacentIndex  <Patch>  <Integer>  <Integer>

Description : Gets the index of the sub-patch that is adjacent to the given sub-patch by a given edge, if it exists (cf. "1. Patches representation with 3DSMax3").

 

Arguments:

·         <Patch>: the target patch node.

·         <Integer> : the index of the sub-patch.

·         <Integer> : the index of the expected shared edge, between 1 and 3 for a tri-patch, 1 and 4 for a quad-patch.

 

Returns : <Integer> the index of the adjacent sub-patch.

 

See also: GetAdjacentIndexes.

 

 

 

GetAdjacentIndexes  <Patch>  <Integer>

Description : Returns an array of indexes : for each edge of a given sub-patch, the index of the sub-patch that shares the edge, if it exist (cf. "1. Patches representation with 3DSMax3"). The result is an array of three or four integers (resp. for a tri-patch or a quad-patch), where 0 means that the edge isn’t shared with another sub-patch.

 

Arguments:

·         <Patch>: the target patch node.

·         <Integer>: the index of the sub-patch.

 

Returns : <#(3|4)(Integer)> indexes of adjacent sub-patches.

 

See also: GetAdjacentIndex.

 

 

 

GetEdgeFromVec  <Patch>  <Integer>

Description : Retrieves the edge that references the given vector. Since interior points are, at mesh level, managed like tangent vectors (cf. remark "1.1 Quad-Patch"), the given index may point to an interior point. In this case, a runtime error is generated. The type of a vector is returned by the function GetVecType.

 

Arguments:

·         <Patch>: the target patch node.

·         <Integer> : the index of the vector.

 

Returns : <Integer> the index of the edge.

 

See also: GetEdgeIndex, GetEdgeIndexes, GetEdgeFromVert, GetVertFromVec, GetPatchFromVec, GetVecType.

 

 

GetEdgeFromVert  <Patch>  <Integer>

Description : Retrieves the list of edges that use the given vertex. The number of edges sharing a vertex has no upper limit.

 

Arguments:

·         <Patch>: the target patch node.

·         <Integer> : the index of the vertex in the mesh.

 

Returns : <#n(Integer)> the edge indexes list.

 

See also: GetEdgeIndex, GetEdgeIndexes, GetEdgeFromVec, GetVecFromVert, GetPatchFromVert.

 

 

GetEdgeIndex  <Patch>  <Integer>  <Integer>

Description : Returns the mesh-index of a given edge number in a given sub-patch (cf. "1. Patches representation with 3DSMax3").

 

Arguments:

·         <Patch>: the target patch node.

·         <Integer>: the index of the sub-patch where the edge is.

·         <Integer> : the index of the edge, between 1 and 3 for a tri-patch, 1 and 4 for a quad-patch.

 

Returns : <Integer> the index of the edge in the mesh.

 

See also: GetEdgeIndexes.

 

 

GetEdgeIndexes  <Patch>  <Integer>

Description : Retrieves the 3 or 4 edges’ mesh-indexes of a given sub-patch (cf. "1. Patches representation with 3DSMax3").

 

Arguments:

·         <Patch>: the target patch node.

·         <Integer>: the index of the sub-patch.

 

Returns : <#(3|4)(Integer)> the indexes of the edges.

 

See also: GetEdgeIndex.

 

 

 

GetInteriorAuto  <Patch>  <Integer>

Description : Tells if interior points of a given sub-patch are computed automatically by 3DSMax or not (cf. "1.4 Interior points").

 

Arguments:

·         <Patch> : the target patch node.

·         <Integer>: the index of the sub-patch.

 

Returns: <Boolean> true for an automatic computation, false for a manual positioning.

 

See also: SetInteriorAuto, SetAllInteriorAuto, SetSelInteriorAuto.

 

 

GetInteriorIndex  <Patch>  <Integer>  <Integer>

Description : Returns the mesh-index of a given interior point in a given sub-patch (cf. "1. Patches representation with 3DSMax3").

 

Arguments:

·         <Patch>: the target patch node.

·         <Integer>: the index of the sub-patch.

·         <Integer>: the index of the interior point, between 1 and 3 for a tri-patch, 1 and 4 for a quad-patch.

 

Returns : <Integer> the index of the interior point.

 

See also : GetInteriorIndexes, GetMeshVec, GetPatchInterior.

 

 

GetInteriorIndexes  <Patch>  <Integer>

Description : Retrieves the 3 or 4 interior points indexes (in the mesh) of a given sub-patch (cf. "1. Patches representation with 3DSMax3").

 

Arguments:

·         <Patch>: the target patch node.

·         <Integer>: the index of the sub-patch.

 

Returns : <#(3|4)(Integer)> the indexes of the interior points.

 

See also : GetInteriorIndexes, GetMeshVec, GetPatchInterior.

 

 

GetMapChannels  <Patch>

Description : Returns the currently used mapping channels.

 

Argument: <Patch>: the target patch node.

 

Returns : <#n(Integer)> the indexes of the used mapping channels.

 

See also: CreateMapChannel, DeleteMapChannel.

 


 

GetMapPatch  <Patch>  <Integer>  <Integer>

Description : Returns the indexes of mapping vertices that are used by a given mapping sub-patch, in a given mapping channel.

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the mapping channel, between 0 and 99.

·         <Integer> : the index of the mapping sub-patch.

 

Returns : <#4(Integer)> the indexes of the mapping vertices.

 

See also : SetMapPatch, GetMapVert, GetMapChannels.

 

 

GetMapVert  <Patch>  <Integer>  <Integer>

Description : Returns, for a given mapping channel, the (u,v,w) coordinates of a given mapping vertex (or a vertex color if you specify the mapping channel 0).

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the mapping channel, between 0 and 99.

·         <Integer> : the index of the mapping vertex.

 

Returns : <Point3> the coordinates of the mapping vertex or the vertex color.

 

See also : SetMapVert, GetMapPatch, GetMapChannels.

 

 

GetMatID  <Patch>  <Integer>

Description : Returns the material ID of a given sub-patch.

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the sub-patch.

 

Returns : <Integer> the material ID, between 0 and 65535.

 

See also : SetMatID.

 

 

GetMeshVec  <Patch>  <Integer>

Description : Returns the position of a vector or interior point, in the local coordinates system.

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the vector.

 

Returns : <Point3> the coordinates of the vector.

 

See also : SetMeshVec, GetPatchVec.


 

GetMeshVert  <Patch>  <Integer>

Description : Returns the position of a vertex, in the local coordinates system.

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the vertex.

 

Returns : <Point3> the coordinates of the vertex.

 

See also : SetMeshVert, GetPatchVert.

 

 

GetNumEdges  <Patch>

Description : Returns the number of edges.

 

Argument : <Patch> : the target patch node.

 

Returns : <Integer> the number of edges.

 

 

GetNumMapVerts  <Patch>  <Integer>

Description : Returns the number of mapping vertices in the given mapping channel.

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the mapping channel, between 0 and 99.

 

Returns : <Integer> the number of mapping vertices.

 

 

GetNumPatches  <Patch>

Description : Returns the number of sub-patches.

 

Argument : <Patch> : the target patch node.

 

Returns : <Integer> the number of sub-patches.

 

 

GetNumVecs  <Patch>

Description : Returns the number of vectors (interior points included).

 

Argument : <Patch> : the target patch node.

 

Returns : <Integer> the number of vectors.

 

 

GetNumVerts  <Patch>

Description : Returns the number of vertices.

 

Argument : <Patch> : the target patch node.

 

Returns : <Integer> the number of vertices.

 

 

 

 

GetPatchFromEdge  <Patch>  <Integer>

Description : Retrieves the sub-patches that reference the given edge (1 or 2).

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the edge in the mesh.

 

Returns : <#(1|2)(Integer)> the indexes of the sub-patches.

 

See also : GetPatchFromVec, GetPatchFromVert, GetVecFromEdge, GetVertFromEdge.

 

 

GetPatchFromVec  <Patch>  <Integer>

Description : Retrieves the sub-patches that reference the given vector (or interior point) (1 or 2).

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the vector.

 

Returns : <#(1|2)(Integer)> the indexes of the sub-patches.

 

See also : GetPatchFromVert, GetPatchFromEdge, GetVertFromVec, GetEdgeFromVec, GetVecType.

 

 

GetPatchFromVert  <Patch>  <Integer>

Description : Retrieves the (n) sub-patches that reference the given vertex.

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the vertex.

 

Returns : <#n(Integer)> the indexes of the sub-patches.

 

See also : GetPatchFromVec, GetPatchFromEdge, GetVecFromVert, GetEdgeFromVert.

 

 

GetPatchInterior  <Patch>  <Integer>  <Integer>

Description : Returns the position of an interior point, in the local coordinates system (cf "1. Patches representation with 3DSMax3").

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the sub-patch.

·         <Integer> : the index of the interior point, between 1 and 3 for a tri-patch, 1 and 4 for a quad-patch.

 

Returns : <Point3> the coordinates of the interior vertex.

 

See also : GetMeshVec, GetInteriorIndex, GetInteriorIndexes.

 

 


 

GetPatchVec  <Patch>  <Integer>  <Integer>

Description : Returns the position of a vector in the local coordinates system (cf "1. Patches representation with 3DSMax3").

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the sub-patch.

·         <Integer> : the index of the vector, between 1 and 3 for a tri-patch, 1 and 4 for a quad-patch.

 

Returns : <Point3> the coordinates of the vector.

 

See also: GetMeshVec, GetVecIndex, GetVecIndexes.

 

 

GetPatchVert  <Patch>  <Integer>  <Integer>

Description : Returns the position of a vertex in the local coordinates system (cf "1. Patches representation with 3DSMax3").

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the sub-patch.

·         <Integer> : the index of the vertex, between 1 and 3 for a tri-patch, 1 and 4 for a quad-patch.

 

Returns : <Point3> the coordinates of the vertex.

 

See also : GetMeshVert, GetVertIndex, GetVertIndexes.

 

 

GetRenderSteps  <Patch>

Description : Returns the number of render subdivisions.

 

Argument : <Patch> : the target patch node.

 

Returns : <Integer> the number of render steps.

 

See also : SetRenderSteps, GetViewSteps.

 

 

GetSel  <Patch> <Integer>

Description : Returns an array containing the indexes of the selected elements, according to the given sub-object level.

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the sub-object level :

§         1 : vertex level

§         2 : edge level

§         3 : sub-patch level

 

Returns : <#n(Integer)> the indexes of the elements currently selected.

 

See also : SetSel.

 

 

 

 

GetSmGroup  <Patch>  <Integer>

Description : Returns the smoothing groups of a given sub-patch (signed 32 bits integer).

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the sub-patch.

 

Returns : <Integer> the smoothing groups, between -2147483648 and +2147483647.

 

See also : SetSmGroup, GetSmGroupBits.

 

 

GetSmGroupBits  <Patch>  <Integer>

Description : This function returns the smoothing groups of a given sub-patch as an array of 32 integers.

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the sub-patch.

 

Returns : <#32(0|1)> the smoothing groups.

 

See also : SetSmGroupBit, GetSmGroup.

 

 

GetType  <Patch>  <Integer>

Description : Tells the type of a given sub-patch : tri-patch or quad-patch.

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the sub-patch.

 

Returns : <0|1> 0 for a quad-patch, 1 for a tri-patch.

 

 

GetVecFromEdge  <Patch>  <Integer>

Description : Retrieves the 2 indexes of the vectors that are used in the given edge.

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the edge in the mesh.

 

Returns : <#2(Integer)> the indexes of the 2 vectors.

 

See also : GetVecIndex, GetVecIndexes, GetVecFromVert, GetVertFromEdge, GetPatchFromEdge.

 


 

GetVecFromVert  <Patch>  <Integer>

Description : Retrieves the indexes of the tangent vectors (not the interior points) that start from the given vertex. The number of vectors using the same vertex has no upper limit.

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the vertex in the mesh.

 

Returns : <#n(Integer)> the indexes of the tangent vectors.

 

See also : GetVecIndex, GetVecIndexes, GetVecFromEdge, GetEdgeFromVert, GetPatchFromVert.

 

 

GetVecIndex  <Patch>  <Integer>  <Integer>

Description : Returns the index in the mesh of a given tangent vector within a given sub-patch (cf. "1. Patches representation in 3DSMax3").

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the sub-patch where the tangent vector is used.

·         <Integer> : the index of the tangent vector, between 1 and 6 for a tri-patch, 1 and 8 for a quad-patch.

 

Returns : <Integer> the mesh-index of the tangent vector.

 

See also : GetVecIndexes.

 

 

GetVecIndexes  <Patch>  <Integer>

Description : Retrieves the indexes of the six or eight tangent vectors (in the mesh) of a given sub-patch (cf. "1. Patches representation with 3DSMax3").

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the sub-patch.

 

Returns : <#(6|8)(Integer)> the indexes of the tangent vectors.

 

See also : GetVecIndex.

 

 

GetVecType  <Patch>  <Integer>

Description : Tells the type of given vector : interior point or tangent vector (cf. Remark "1. Patches representation with 3DSMax3").

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the vector in the mesh.

 

Returns : <0|1> 0 for a tangent vector, 1 for an interior point.

 


 

GetVertexType  <Patch>  <Integer>

Description : Tells the type of a given vertex : coplanar or corner.

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the vertex in the mesh.

 

Returns : <0|1> 0 for corner, 1 for coplanar.

 

See also : SetVertexType.

 

 

GetVertFromEdge  <Patch>  <Integer>

Description : Retrieves the 2 indexes of the vertices that are used in a given edge.

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the edge in the mesh.

 

Returns : <#2(Integer)> the indexes of the vertices.

 

See also : GetVertIndex, GetVertIndexes, GetVertFromVec, GetVecFromEdge, GetPatchFromEdge.

 

 

GetVertFromVec  <Patch>  <Integer>

Description : Retrieves the index of the vertex that is the origin of the given tangent vector.

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the vector in the mesh.

 

Remark :

·         Interior points, handled like tangent vectors at the mesh level (cf. Remark "1. Patches representation with 3DSMax3"), aren’t referenced by vertices but by sub-patches. If the given index refers to an interior point, a runtime error is generated.

 

Returns : <Integer> the index of the vertex.

 

See also : GetVecType, GetVertIndex, GetVertIndexes, GetVertFromEdge, GetEdgeFromVec, GetPatchFromVec.

 

 

GetVertIndex  <Patch>  <Integer>  <Integer>

Description : Returns the mesh-index of a given vertex used by a given sub-patch (cf. "1. Patches representation with 3DSMax3").

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the sub-patch.

·         <Integer> : the index of the vertex, between 1 and 3 for a tri-patch, 1 and 4 for a quad-patch.

 

Returns : <Integer> the index of the vertex.

 

See also : GetVertIndexes.

 

 

 

GetVertIndexes  <Patch>  <Integer>

Description : Retrieves the 3 or 4 indexes of the vertices of a given sub-patch (cf. "1. Patches representation with 3DSMax3").

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the sub-patch.

 

Returns : <#(3|4)(Integer)> the indexes of the vertices.

 

See also : GetVertIndex.

 

 

GetViewSteps  <Patch>

Description : Returns the number of view subdivisions.

 

Argument : <Patch> : the target patch node.

 

Returns : <Integer> the number of view steps.

 

See also : SetViewSteps, GetRenderSteps.

 

 

Help  [<Name|#all>]

Description : This function gives the syntax for a given function, or for all of the functions of CryoPatch (argument = #all).

 

Argument : (Optional, #all is the default case)

<Name|#all> : <Name> the name of the function (example : #GetVecType) for a specific syntax, or #all for all of the functions.

 

Returns : <String> the correct command line(s).

 

See also : List.

 

 

Interpolate  <Patch>  <Integer>  <Float>  <Float>

Description : This function computes the position of the point (u,v), in the local coordinates system (cf. "1. Patches representation with 3DSMax3") within a given sub-patch.

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the sub-patch where the point is requested.

·         <Float> : first coordinate (u) of the point, between 0 and 1.

·         <Float> : second coordinate (v) of the point, between 0 and 1.

 

Returns : <Point3> the position of the point.

 

See also : InterpolateNorm.

 


 

InterpolateNorm  <Patch>  <Integer>  <Float>  <Float>

Description : This function computes the normal vector at the point (u,v), in the local coordinates system (cf. "1. Patches representation with 3DSMax3") within a given sub-patch.

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of sub-patches where is the point.

·         <Float> : first coordinate (u) of the point, between 0 and 1.

·         <Float> : second coordinate (v) of the point, between 0 and 1.

 

Returns : <Point3> the normal vector of the patch at the specified point.

 

See also : Interpolate.

 

 

List  ()

Description : Lists the available functions in CryoPatch. They are sorted from higher (object) to lower (vertex) sub-object level.

 

Arguments : none.

 

Returns : <String> the function list.

 

See also : Help.

 

 

PatchToWorld  <Patch>  <Point3>

Description : Cinverts a given Point3 from the local coordinates system to the world coordinates system.

 

Arguments :

·         <Patch> : the target patch node.

·         <Point3> : the point to get in the global coordinates system.

 

Returns : <Point3> the coordinates of the converted point.

 

See also : WorldToPatch.

 

 

SetAllInteriorAuto  <Patch>  <Boolean>

Description : Sets the positioning mode of interior points for all the sub-patches (cf. "1.4 Interior points").

 

Arguments :

·         <Patch> : the target patch node.

·         <Boolean> : the positioning mode : true for automatic, false for manual.

 

See also : SetInteriorAuto, SetSelInteriorAuto, GetInteriorAuto.

 

 


 

SetInteriorAuto  <Patch>  <Integer>  <Boolean>

Description : Sets the positioning mode of interior points for a given sub-patch (cf. "1.4 Interior points").

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the sub-patch.

·         <Boolean> : the positioning mode : true for automatic, false for manual.

 

See also : SetAllInteriorAuto, SetSelInteriorAuto, GetInteriorAuto.

 

 

SetMapPatch  <Patch>  <Integer>  <Integer>  <#4(Integer|Point3) >

Description : Iinitialises a mapping sub-patch with 4 mapping vertices. These ones are given, like the sub-patch creation (cf. CreateAdjQuadPatch), by an index if they already exist, or by a Point3  (u,v,w) if a new mapping vertex has to be added to the mapping channel.

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the mapping channel.

·         <Integer> : the index of the mapping sub-patch to set.

·         <#4(Integer|Point3)> : the 4 (index or new (u,v,w)) of the mapping vertices used to build the mapping sub-patch.

 

See also : GetMapPatch, SetMapVert, GetMapChannels, GetNumMapVerts.

 

 

SetMapVert  <Patch>  <Integer>  <Integer>  <Point3>

Description : Sets the (u,v,w) coordinates of a given mapping vertex, in a given mapping channel.

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the mapping channel.

·         <Integer> : the index of the mapping vertex to set.

·         <Point3> : the new (u,v,w) mapping coordinates.

 

See also : GetMapVert, SetMapPatch, GetMapChannels, GetNumMapVerts.

 

 

SetMatID  <Patch>  <Integer>  <Integer>

Description : Assigns a material ID to a given sub-patch.

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the sub-patch.

·         <Integer> : the material ID, between 0 and 65535.

 

See also : GetMatID.

 


 

SetMeshVec  <Patch>  <Integer>  <Point3>

Description : Mmodifies the position of a vector or an interior point, in the local coordinates system.

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the vector.

·         <Point3> : the new coordinates of the vector.

 

See also : GetMeshVec, SetPatchVec.

 

 

SetMeshVert  <Patch>  <Integer>  <Point3>

Description : Modifies the position of a vertex, in the local coordinates system.

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the vertex.

·         <Point3> : le nouveau vertex.

 

See also : GetMeshVert, SetPatchVert.

 

 

SetPatchInterior  <Patch>  <Integer>  <Integer>  <Point3>

Description : Modifies the position of an interior point, in the local coordinates system (cf "1. Patches representation with 3DSMax3").

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the sub-patch.

·         <Integer> : the index of the interior point, between 1 and 3 for a tri-patch, 1 and 4 for a quad-patch.

·         <Point3> : the new coordinates of the interior point.

 

See also : GetPatchInterior, SetMeshVec, GetInteriorIndex, GetInteriorIndexes.

 

 

SetPatchVec  <Patch>  <Integer>  <Integer>  <Point3>

Description : Modifies the position of a tangent vector, in the local coordinates system (cf "1. Patches representation with 3DSMax3").

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the sub-patch.

·         <Integer> : the index of the tangent vector, between 1 and 6 for a tri-patch, 1 and 8 for a quad-patch.

·         <Point3> : the new coordinates of the vector.

 

See also : GetPatchVec, SetMeshVec, GetVecIndex, GetVecIndexes.

 

 

 

 

 

 

 

 

SetPatchVert  <Patch>  <Integer>  <Integer>  <Point3>

Description : Modifies the position of a vertex, in the local coordinates system (cf "1. Patches representation with 3DSMax3").

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the sub-patch.

·         <Integer> : the index of the vertex, between 1 and 3 for a tri-patch, 1 and 4 for a quad-patch.

·         <Point3> : the new coordinates of the vertex.

 

See also : GetPatchVert, SetMeshVert, GetVertIndex, GetVertIndexes.

 

 

SetRenderSteps  <Patch>  <Integer>

Description : Sets the number of render steps.

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the new number of render steps.

 

See also : GetRenderSteps, SetViewSteps.

 

 

SetSel  <Patch> <Integer>  <#n(Integer)>

Description : Selects the elements referenced by the n given indexes, according to the given sub-object level.

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the sub-object level.

·         <#n(Integer)> : an array of indexes referencing the sub-objects to select.

 

See also : GetSel.

 

 

SetSelInteriorAuto  <Patch>  <Boolean>

Description : Defines the positioning mode of the interior points in the currently selected sub-patches (cf. "1.4 Interior points") (whatever the current sub-object level).

 

Arguments :

·         <Patch> : the target patch node.

·         <Boolean> : the positioning mode : true for automatic, false for manual.

 

See also : SetInteriorAuto, SetSelInteriorAuto, GetInteriorAuto.

 

 

SetSmGroup  <Patch>  <Integer>  <Integer>

Description : Sets the smoothing groups of a given sub-patch.

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the sub-patch.

·         <Integer> : the new smoothing groups, between -2147483648 and +2147483647.

 

See also : GetSmGroup, SetSmGroupBit.

 

 

 

SetSmGroupBit  <Patch>  <Integer>  <Integer>  <0|1>

Description : Sets or clears a single bit of the smoothing groups for a given sub-patch.

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the sub-patch.

·         <Integer> : the index of the bit to modify.

·         <0|1> : the new bit state.

 

See also : GetSmGroupBits, SetSmGroup.

 

 

SetVertexType  <Patch>  <Integer>  <0|1>

Description : Sets the type of a vertex : coplanar or corner.

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the vertex in the mesh.

·         <0|1> : the new vertex type : 0 for corner, 1 for coplanar.

 

See also : GetVertexType.

 

 

SetViewSteps  <Patch>  <Integer>

Description : Sets the number of view subdivisions.

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the new number of view steps.

 

See also : GetViewSteps, SetRenderSteps.

 

 

ShrinkMapVerts  <Patch>  <Integer>

Description : This function removes all of the unused mapping vertices in a given mapping channel.

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the mapping channel.

 

See also : SetMapPatch, SetMapVerts, GetMapChannels, GetNumMapVerts.

 

 

ShrinkVerts  <Patch>

Description : Removes all the unused free vertices.

 

Argument : <Patch> : the target patch node.

 

See also : AppendVerts.

 

 

SplitEdge  <Patch>  <Integer>

Description : Splits a shared edge into two edges, to remove the adjacency between two sub-patches.

 

Arguments :

·         <Patch> : the target patch node.

·         <Integer> : the index of the edge in the mesh.

 

Returns : <Integer> the index of the edge newly created.

 

See also : FuseEdges.

 

 

 

WorldToPatch  <Patch>  <Point3>

Description : Converts a point3 from the world coordinates system to the local coordinates system.

 

Arguments :

·         <Patch> : the target patch node.

·         <Point3> : the point to get in the global coordinates system.

 

Returns : <Point3> the coordinates of the converted point.

 

See also : PatchToWorld.

 


 

PERSONNAL NOTES :